<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <head>
        <title>检测对象是否为空</title>
        <link href="style23.css" rel="stylesheet" type="text/css" />
        <script src="http://www.imooc.com/data/jquery-1.8.2.min.js" type="text/javascript"></script>
    </head>
    
    <body>
        <div id="divtest">
            <div class="title">
                <span class="fl">检测对象是否为空</span> 
            </div>
            <div class="content"></div>
        </div>
        
        <script type="text/javascript">
            $(function () {
                var obj = { "姓名": "土豪一族" };
                var strTmp = "您定义了一个：";
                if ($.isEmptyObject(obj)) { //检测是否为空
                    strTmp += "空对象";
                }
                else {
                    strTmp += "非空对象";
                }
                $(".content").html(strTmp);
            });
        </script>
    </body>
</html>